﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YmtAuth.Domain.Shard
{
    /// <summary>
    /// 认证相关配置通用
    /// </summary>
   public class AuthConfiguration
    {
       public string AppId { get; private set; }
       public string Code { get; private set; }
        public string Key { get; private set; }
        public string Value { get; private set; }
       public DateTime? CreateTime { get; private set; }
       public DateTime? LastUpdateTime { get; private set; }
        public string Description { get; private set; }

        public AuthConfiguration(string appid, string code, string key, string value, string description=null)
       {
           this.AppId = appid;
           this.Code = code;
           this.Key = key;
           this.Value = value;
           this.CreateTime = DateTime.Now;
           this.LastUpdateTime = DateTime.Now;
           this.Description = description;
       }

       /// <summary>
       /// 获取Key。 格式：appId_code_Key
       /// </summary>
       /// <returns></returns>
        public string GetKey()
        {
            return string.Format("{0}_{1}_{2}", this.AppId, this.Code, this.Key);
        }

        protected AuthConfiguration()
       {

       }
    }
}
